package com.neusoft.neuiotms.dcom.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.InspectionRuleProjectItemDTO;
import com.neusoft.neuiotms.dcom.model.InspectionRuleProjectItem;

@Component
public class InspectionRuleProjectItemConverter
        extends AbstractConverter<InspectionRuleProjectItem, InspectionRuleProjectItemDTO> {

    @Override
    public InspectionRuleProjectItem toModel(final InspectionRuleProjectItemDTO dto) {
        final InspectionRuleProjectItem model = new InspectionRuleProjectItem();
        model.setAlarm(dto.getAlarm());
        model.setAlarmDown(dto.getAlarmDown());
        model.setAlarmUpper(dto.getAlarmUpper());
        model.setEarlyWarning(dto.getEarlyWarning());
        model.setEarlyWarningDown(dto.getEarlyWarningDown());
        model.setEarlyWarningUpper(dto.getEarlyWarningUpper());
        model.setName(dto.getName());
        model.setSort(dto.getSort());
        model.setValueType(dto.getValueType());
        model.setType(dto.getType());
        model.setUnit(dto.getUnit());
        return model;
    }

    @Override
    public InspectionRuleProjectItemDTO toDTO(final InspectionRuleProjectItem model, final boolean forListView) {
        final InspectionRuleProjectItemDTO dto = new InspectionRuleProjectItemDTO();
        dto.setName(model.getName());
        dto.setSort(model.getSort());
        dto.setValueType(model.getValueType());
        dto.setId(model.getId());
        dto.setType(model.getType());
        dto.setAlarm(model.getAlarm());
        dto.setAlarmDown(model.getAlarmDown());
        dto.setAlarmUpper(model.getAlarmUpper());
        dto.setEarlyWarning(model.getEarlyWarning());
        dto.setEarlyWarningDown(model.getEarlyWarningDown());
        dto.setEarlyWarningUpper(model.getEarlyWarningUpper());
        dto.setUnit(model.getUnit());
        return dto;
    }

}
